package com.gitee.huxing.course.netty.gateway.filter;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpRequest;

import java.time.LocalDateTime;

/**
 * @Description:
 * @ProjectName: JavaCourse
 * @Package: com.gitee.huxing.course.netty.gateway.filter
 * @ClassName: HttpHeaderRequestFilter
 * @Author: huxing
 * @DateTime: 2021-08-19 下午12:27
 */
public class HttpHeaderRequestFilter implements HttpRequestFilter{

    @Override
    public void filter(FullHttpRequest request, ChannelHandlerContext ctx) {
        // 简单的处理 - 添加一个请求报文请求时间
        request.headers().set("requestTime", LocalDateTime.now().toString());
    }
}
